import json
from abc import ABC, abstractmethod


class BaseModel(ABC):
    @abstractmethod
    def setWS(self):
        pass

    # 训练
    @abstractmethod
    def train(self):
        pass

    # 绘图
    @abstractmethod
    def draw(self):
        pass

    @abstractmethod
    def view(self):
        pass

    @staticmethod
    def result(resultType=None, command=None, code=None, message=None, data=None):
        obj = {
            "result-type": resultType,
            "command": command,
            "code": code,
            "message": message,
            "data": data
        }
        return json.JSONEncoder().encode(obj)
